package LeetcodeTest_six;
//2的1多少次幂
public class isPowerOfTwo
{
    public static void main(String[] args)
    {
        boolean answer=Solution.isPowerOfTwo(2);
        System.out.println(answer);
    }
}
class Solution
{
    public static boolean isPowerOfTwo(int n)
    {
        int i=0;
        if(n==1)
            return true;
        while(n>0)
        {
            if(n%2!=0)
                return false;
            n=n/2;
            if(n%2!=0)
                return n==1;
        }
        return  false;
    }
}